package de.hmm.hwip.messagehandler.api;

import java.net.Socket;
import org.json.JSONObject;
import org.osgi.framework.BundleContext;

import android.os.Bundle;

/**
 * Interface that defines the messagehandler
 * 	which leads commands to their correct factorypart
 * 
 * @author Johannes Mendel
 * @version 25.09.2012
 *
 */

public interface IMessageHandler {
	/**
	 * Starting the messagehandler service.
	 * This is a kind factory pattern.
	 * Via the FQD the referenced class is generated and started as single thread
	 * to dealing simultaneously incoming requests 
	 * 
	 * @param fqd = URL of the service - e.g. de.hmm.hwip.message.command
	 * @param context - osgi bundle context
	 * @param payload - Json-String with received payload data
	 * @param connection - socket connection data to answer end-device
	 * @param securityFlag - defines availability of AES en/decryption
	 */
	public void startAction(String fqd, BundleContext context, JSONObject payload, Socket connection, boolean securityFlag);
	
	/**
	 * Starting the messagehandler service.
	 * This is a kind factory pattern.
	 * Via the FQD the referenced class is generated and started as single thread
	 * to dealing simultaneously incoming requests 
	 * 
	 * @param fqd = URL of the service - e.g. de.hmm.hwip.message.command
	 * @param radio = Identifier of radio type
	 * @param deviceMessage = Datas sent by System Device
	 * @param context = Bundlecontext of OSGi
	 */
	public void startAction(String fqd, int radio, Bundle deviceMessage, BundleContext context);
}
